package com.cre_drt;

import java.io.Serializable;
import java.util.HashMap;

import com.att.intern.webservice.Webservice;

import android.app.ActionBar;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.widget.EditText;

public class BuildingConditionReportScreen extends ActivityTimeout{
	
	EditText eventName;
	EditText GLC;
	EditText propertyType;
	EditText address;
	EditText state;
	EditText pmATTUID;
	EditText assessment;
	EditText status;
	EditText initialRequestDate;
	EditText buildingStatus;
	
	HashMap<String, String> sessionInfo;
	
	SessionManager session;
	Webservice searchWebservice;
	
	HashMap<String, HashMap<String, String>> reportInfo;

	@SuppressWarnings("unchecked")
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.building_condition_report_screen);
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
		ActionBar actionBar = getActionBar();
		actionBar.setTitle("CRE Building Closure/Delayed" + "\n" + "Open Canned Report");
		actionBar.setSubtitle("Damage Report Results");
		
		session = new SessionManager(getApplicationContext());
		sessionInfo = session.getSessionDetails();

		eventName = (EditText) findViewById(R.id.eventNameEdit);
		GLC = (EditText) findViewById(R.id.glcEdit);
		propertyType = (EditText) findViewById(R.id.propertyTypeEdit);
		address = (EditText) findViewById(R.id.addressEdit);
		state = (EditText) findViewById(R.id.stateEdit);
		pmATTUID = (EditText) findViewById(R.id.pmATTUIDEdit);
		assessment = (EditText) findViewById(R.id.assessmentEdit);
		status = (EditText) findViewById(R.id.statusEdit);
		initialRequestDate = (EditText) findViewById(R.id.intitialRequestDateEdit);
		buildingStatus = (EditText) findViewById(R.id.buildingStatusEdit);
		
		Serializable data = getIntent().getSerializableExtra("reportInfo");
		reportInfo = (HashMap<String, HashMap<String,String>>)data;
		
		setUpReport();
	}
	
	public void setUpReport() {
		eventName.setText(String.valueOf(reportInfo.get("eventName")));
		initialRequestDate.setText(String.valueOf(reportInfo.get("initialReportDate")));
		GLC.setText(String.valueOf(reportInfo.get("GLC")));
		buildingStatus.setText(String.valueOf(reportInfo.get("buildingStatus")));
		propertyType.setText(String.valueOf(reportInfo.get("propertyType")));
		address.setText(String.valueOf(reportInfo.get("address")));
		state.setText(String.valueOf(reportInfo.get("state")));
		pmATTUID.setText(String.valueOf(reportInfo.get("pmATTUID")));
		assessment.setText(String.valueOf(reportInfo.get("assessment")));
		status.setText(String.valueOf(reportInfo.get("status")));
	}
}
